﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.db2
{
	// Token: 0x020001D9 RID: 473
	public class TDb2ForStmt : TBlockSqlStatement
	{
		// Token: 0x06000FE7 RID: 4071 RVA: 0x0030C4F4 File Offset: 0x0030A6F4
		public TDb2ForStmt(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstdb2forstmt;
		}

		// Token: 0x06000FE8 RID: 4072 RVA: 0x0030C508 File Offset: 0x0030A708
		internal override void buildsql()
		{
		}

		// Token: 0x06000FE9 RID: 4073 RVA: 0x0030C50A File Offset: 0x0030A70A
		internal override void clear()
		{
		}

		// Token: 0x06000FEA RID: 4074 RVA: 0x0030C50C File Offset: 0x0030A70C
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000FEB RID: 4075 RVA: 0x0030C513 File Offset: 0x0030A713
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x170002F6 RID: 758
		// (get) Token: 0x06000FEC RID: 4076 RVA: 0x0030C515 File Offset: 0x0030A715
		// (set) Token: 0x06000FED RID: 4077 RVA: 0x0030C51D File Offset: 0x0030A71D
		public virtual TObjectName CursorName
		{
			get
			{
				return this.cursorName;
			}
			set
			{
				this.cursorName = value;
			}
		}

		// Token: 0x170002F7 RID: 759
		// (get) Token: 0x06000FEE RID: 4078 RVA: 0x0030C526 File Offset: 0x0030A726
		// (set) Token: 0x06000FEF RID: 4079 RVA: 0x0030C52E File Offset: 0x0030A72E
		public virtual TObjectName LoopName
		{
			get
			{
				return this.loopName;
			}
			set
			{
				this.loopName = value;
			}
		}

		// Token: 0x170002F8 RID: 760
		// (get) Token: 0x06000FF0 RID: 4080 RVA: 0x0030C537 File Offset: 0x0030A737
		// (set) Token: 0x06000FF1 RID: 4081 RVA: 0x0030C53F File Offset: 0x0030A73F
		public virtual TSelectSqlStatement Subquery
		{
			get
			{
				return this.subquery;
			}
			set
			{
				this.subquery = value;
			}
		}

		// Token: 0x06000FF2 RID: 4082 RVA: 0x0030C548 File Offset: 0x0030A748
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			TForSqlNode tforSqlNode = (TForSqlNode)this.rootNode;
			this.loopName = tforSqlNode.LoopName;
			this.cursorName = tforSqlNode.CursorName;
			if (tforSqlNode.SelectNode != null)
			{
				this.subquery = new TSelectSqlStatement(EDbVendor.dbvdb2);
				this.subquery.rootNode = tforSqlNode.SelectNode;
				this.subquery.doParseStatement(this);
			}
			if (tforSqlNode.StmtListNode != null)
			{
				tforSqlNode.StmtListNode.doParse(this, ESqlClause.unknown);
				for (int i = 0; i < tforSqlNode.StmtListNode.size(); i++)
				{
					this.BodyStatements.add(tforSqlNode.StmtListNode.getStatementSqlNode(i).Stmt);
				}
			}
			return 0;
		}

		// Token: 0x06000FF3 RID: 4083 RVA: 0x0030C605 File Offset: 0x0030A805
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000FF4 RID: 4084 RVA: 0x0030C615 File Offset: 0x0030A815
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.subquery != null)
			{
				this.subquery.accept(v);
			}
			if (this.BodyStatements.size() > 0)
			{
				this.BodyStatements.accept(v);
			}
			v.postVisit(this);
		}

		// Token: 0x04001385 RID: 4997
		private TObjectName loopName;

		// Token: 0x04001386 RID: 4998
		private TObjectName cursorName;

		// Token: 0x04001387 RID: 4999
		private TSelectSqlStatement subquery;
	}
}
